class LoadingComponent extends eui.Component {

    public constructor() {
        super();
        this.skinName = "LoadingComponentSkin";
        this.addEventListener(egret.Event.ADDED_TO_STAGE, this.addToStage, this);
    }

    private addToStage() {
        const {stageWidth, stageHeight} = this.stage;
        const mcJson = RES.getRes("loading_json");
        const mcTex = RES.getRes("loading_png");
        const mcFactory: egret.MovieClipDataFactory = new egret.MovieClipDataFactory(mcJson, mcTex);
        const mcLoading: egret.MovieClip = new egret.MovieClip(mcFactory.generateMovieClipData("start"));
        this.addChild(mcLoading);
        mcLoading.play(-1);
        mcLoading.x = (stageWidth - mcLoading.width) / 2;
        mcLoading.y = (stageHeight - mcLoading.height) / 3;
    }
}
